<template>
  <div>
    <el-form class="input-form"
             label-position="right"
             label-width="120px"
             ref="editForm"
             :rules="propRules"
             :disabled="propReadonly"
             :model="form"
    >
      <el-row>
        <el-col :span="12">
          <el-form-item label="模板标识" prop="tplKey">
            <el-input v-model="form.tplKey"/>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="模板名称" prop="tplName">
            <el-input v-model="form.tplName"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>

        <el-col :span="12">
          <el-form-item label="短信平台" prop="platform">
            <el-select v-model="form.platform">
              <el-option key="tencent" label="腾讯云" value="tencent"/>
              <el-option key="aliyun" label="阿里云" value="aliyun"/>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="平台编号" prop="platformCode">
            <el-input v-model="form.platformCode"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="模板内容" prop="content">
            <el-input type="textarea" :rows="3" v-model="form.content"/>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="备注" prop="remarks">
            <el-input type="textarea" :rows="5" v-model="form.remarks"/>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>

export default {
  data() {
    return {
      form: {},
      viewData: {}
    }
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)
      },
      afterSave: () => {
        // 用作返回自动主键
        this.$set(this.form, this.propPrimaryKey, this.propViewFormData[this.propPrimaryKey])
      },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      }
    })
  },
  props: ['propPrimaryKey', 'propDictionaries', 'propCurrentRow', 'propViewFormData', 'propReadonly', 'propStatus', 'propRules', 'propInitData'],
  components: {},
  computed: {}
}
</script>

<style lang="scss" scoped>
  .container {
    width: 100%;
    height: 100%;
  }
</style>
